#include<stdio.h>
int main()
{
   char ch[] = "-\\|/";
   char bar[101] = {0};
   size_t i = 0;
   while(i < 100)
   {
      bar[i++] = '*';
      printf("[%-100s][%zu%%][%c]\r",bar,i,ch[i % 4]);
      fflush(stdout);
      usleep(50000);
   }
   printf("\n");
   return 0;
}
